package com.eightbears.beboy.adapter;

import android.content.Context;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.eightbears.beboy.entity.ClassifyEntity;
import com.eightbears.beboy.R;
import com.eightbears.beboy.base.util.SPUtil;
import com.socks.library.KLog;

public class ClassifyAdapter extends BaseQuickAdapter<ClassifyEntity, BaseViewHolder> {
    private Context mContext;
    private ClassifyEntity mClassifyEntity;

    public ClassifyAdapter(Context context) {
        super(R.layout.item_classify, null);
        this.mContext = context;
        mClassifyEntity = SPUtil.getSelClass();
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, ClassifyEntity classifyEntity) {

        baseViewHolder.setText(R.id.tv_classes_name, classifyEntity.getClassifyName())
            .addOnClickListener(R.id.ll_class);
        TextView classifyName = baseViewHolder.getView(R.id.tv_classes_name);
        classifyName.setTextColor(mContext.getResources().getColor(R.color.text_main_color));

        if(mClassifyEntity.getId().equals(classifyEntity.getId())){
            classifyName.setTextColor(mContext.getResources().getColor(R.color.text_select_color));
        }
    }

}
